<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="<?php echo $this->root_dir;?>/static/common/css/common.css" type="text/css" rel="stylesheet">
<link href="<?php echo $this->root_dir;?>/static/common/css/style.css" type="text/css" rel="stylesheet">
<link href="<?php echo $this->root_dir;?>/static/common/css/admin-header.css" type="text/css" rel="stylesheet">
<meta http-equiv="x-ua-compatible" content="ie=7" />
<script type="text/javascript" src="<?php echo $this->root_dir;?>/static/common/js/jquery.min.js"></script>
<script src="<?php echo $this->root_dir;?>/static/common/js/frame.js" type=text/javascript></script>
<script type="text/javascript" src="<?php echo $this->root_dir;?>/static/artDialog/jquery.artDialog.js?skin=default"></script>
<script type="text/javascript" src="<?php echo $this->root_dir;?>/static/artDialog/plugins/iframeTools.js"></script>

<script type="text/javascript" src="<?php echo $this->root_dir;?>/static/common/js/jquery.SuperSlide.2.1.js"></script>
<script type="text/javascript" src="<?php echo $this->root_dir;?>/static/common/js/template.js"></script>
<script type="text/javascript">
var projectName = '<?php echo $this->root_dir;?>';


function menu(obj, tab){
	var ul = $('#admin-menu .nav ul#'+tab);
	$(obj).addClass('sel').siblings().removeClass('sel');
	ul.children('li:first').addClass('sel').siblings().removeClass('sel');
	ul.show().siblings().hide();
	var main_url = ul.find('li:first a').attr('href');
	
	$('IFRAME#main').attr('src',main_url);
	
}

//顶部下拉菜单

	function displaySubMenu(li) { 
	var subMenu = li.getElementsByTagName("ul")[0]; 
	subMenu.style.display = "block"; 
	} 
	function hideSubMenu(li) { 
	var subMenu = li.getElementsByTagName("ul")[0]; 
	subMenu.style.display = "none"; 
	} 

//快捷菜单
function shortcutMenu(){
	var path = projectName;
    var url = '<?php echo \Yii::$app->urlManager->createUrl(['shortcut-menu'])?>';	
	art.dialog.open(url, {
		title: '快捷菜单',
		top:'50%',
		width:'700px',
		height:'500px',
		fixed: true,
		lock:true
		}
	);
	
}

function shortcut(){
    $.getJSON('<?php echo \Yii::$app->urlManager->createUrl(['index/get-shortcut-menu'])?>', {}, function(data){
		
		var div = '.shortcutMenu-list';
		var source = $(div).first().html();
		var render = template.compile(source);
		var html = render({
			list: data
		});
		$(div).eq(1).html(html);
		
	});
	
}

$(function(){

	
})

//左侧导航栏

	$(function(){
		var tabs_i=0
		$('.vtitle').click(function(){
			var _self = $(this);
			var j = $('.vtitle').index(_self);
			if( tabs_i == j ) return false; tabs_i = j;
			$('.vtitle em').each(function(e){
				if(e==tabs_i){
					$('em',_self).removeClass('v01').addClass('v02');
				}else{
					$(this).removeClass('v02').addClass('v01');
				}
			});
			$('.vcon').slideUp().eq(tabs_i).slideDown();
		});
	})
	

	
 //切换导航
	 $(document).ready(function hideuhide(){
		  $('#uhideMenu').click(function(){
		  $('#frmMenu').toggle();
		  });
		});
				 
	 

</script>
</head>
<body class="admin-index" style="overflow:hidden">
<?php
if (!strpos($_SERVER["HTTP_USER_AGENT"], 'WebKit')){
	echo '为了更好的体验，建议使用google chrome浏览器';
}
?>
<table width="100%" height="100%" border=0 cellpadding="0" cellSpacing=0>
<tr>
  <td class="layout-header"><div class="adminer">
      <?php
                echo '<a href="'.Yii::$app->urlManager->createUrl('admin/repass').'" title="点击可修改密码" target="main">'.yii::$app->user->identity->username.'</a>&nbsp;&nbsp;|&nbsp;&nbsp;';
                
        ?>
      <a href="<?php echo Yii::$app->urlManager->createUrl('login/logout',array("username"=>yii::$app->user->identity->username));?>">退出</a> </div>
    <a href="<?php echo Yii::$app->urlManager->createUrl('login/logout',array("username"=>yii::$app->user->identity->username));?>" title="退出登录">
    <div class="icon-close"></div>
    </a> <a href="#" title="选择颜色">
    <div class="icon-color"></div>
    </a> <a href="#" target="_blank">
    <div class="icon-home"></div>
    </a>
    <div class="logo">
      <div class="wx-logo"></div>
      <span class="manager">后台管理</span></div>
    <a  title="切换导航" target="_blank">
    <div class="index" id="uhideMenu" onclick="hideuhide()"></div>
    </a>
    <ul class="nav" id="nav">
      <?php
		$i = 0;
        if (isset($menu['parent'])) foreach($menu['parent'] as $k=>$v){
			
		
		?>
      <li onmouseover="displaySubMenu(this)" onmouseout="hideSubMenu(this)"<?php echo $i==0 ? ' class="active"' : '';?>><a href="<?php echo $this->context->menuCreateUrl($v['controllers']).'/'.$v['params'];?>" target="main"><?php echo $v['name']?></a>
        <ul class="sub">
          <?php
		foreach($menu['data'] as $kk=>$vv){
			if ($vv['parentid'] == $v['menuid']){
			?>
          <li><a href="<?php echo $this->context->menuCreateUrl($vv['controllers']).'/'.$vv['params'];?>" target="main"><?php echo $vv['name']?></a></li>
          <?php
			}
		}
		?>
        </ul>
      </li>
      <?php
		$i++;
		}
		?>
    </ul></td>
</tr>
<tr>
<td width="100%" height="100%" bgcolor="#f5f5f5" valign="top">
<table width="100%" height="100%" cellpadding="0" cellSpacing=0 border=0>
    <tbody>
  
    <tr>
  
  <td noWrap id="frmMenu" width="200" valign="top" class="sitebar" >
      <div class="shortcut-menu">
        <div class="btn-group">
          <button type="button"  class="group-add" onclick="shortcutMenu();" > <i class="icon-plus"></i> </button>
          <dl class="sel">
            <dt>
              <button type="button" id="" class="shortcut">快捷菜单<span class="caret"></span></button>
            </dt>
            <dd>
              <ul class="shortcutMenu-list hidden">
                {{each list as v i}}
                <li><a href="{{v.url}}" target="main" onclick="$('.shortcutMenu-list').parent().hide();">{{v.name}}</a></li>
                {{/each}}              
              </ul>
              <ul class="shortcutMenu-list"></ul>
            </dd>
          </dl>
        </div>
      </div>
      <div class="leftmenu">
  <?php
		$i = 0;
        if (isset($menu['parent'])) foreach($menu['parent'] as $k=>$v){			
		?>
    <ul style="margin-top:10px" class="menu menulist<?php if($i>0){ echo ' hidden'; }?>">
      
      <div class="vtitle" style="display:none;"><em class="v v02"></em><a href="<?php echo $this->context->menuCreateUrl($v['controllers']).'/'.$v['params'];?>" target="main"><?php echo $v['name']?></a></div>
      <div class="vcon">
        <ul class="vconlist clearfix">
          <?php
               $k=0;
		foreach($menu['data'] as $kk=>$vv){
			if ($vv['parentid'] == $v['menuid']){
			?>
          <li  id="udv_<?php echo $k;?>"  class="select"><a href="<?php echo $this->context->menuCreateUrl($vv['controllers']).'/'.$vv['params'];?>" target="main"><?php echo $vv['name']?></a></li>
          <li></li>
          <?php
             $k++;
			}
		}
		?>
        </ul>
      </div>
    </ul>
    <?php
$i++;
		}
		?>
        </div></td>
    <td class="iframe-main">
<table width="100%" height="100%" cellpadding="0" cellSpacing=0 border=0>
          <tbody>
            <tr>
              <td valign="top"><IFRAME id="main" name="main" style="width: 100%; height: 100%" src="<?php echo Yii::$app->urlManager->createUrl('config/index');?>" frameBorder=0></IFRAME></td>
            </tr>
          </tbody>
        </table>
    </td>
  
    </tr>
  
  <tr>
    <td></td>
  </tr>
</table>
<script type="text/javascript">
$(function(){
	var hh = $('.layout-header').height();
	var h = $(window).height();
	var hhh = h-hh-2;
	$('.sitebar').height(hhh);
	$('.iframe-main').height(hhh-$('#admin-nav').height());
	
	$('.nav > li').bind('click',function(){
		var index = $('.nav > li').index(this);
		//alert(index);
               
                $('.leftmenu ul.menulist').eq(index).show().siblings().hide();
                 $('.leftmenu ul.menulist').removeClass('onset');
		 $('.leftmenu ul.menulist').eq(index).addClass('onset');
                $('.leftmenu ul.menulist').eq(index).find('.vcon').show();
                
	    $(this).addClass('active').siblings().removeClass('active');
	});
	
	$('.sub li').live('click', function(){
		//$(this).addClass('active').siblings().removeClass('active');(
		var i='udv_'+$(this).index();
                $(".select").removeClass('on');
                $(".onset #"+i).addClass('on');
                
	});
	$('.leftmenu li').on('click', function(){
		$(this).addClass('on').siblings().removeClass('on');
		
	});
	
	
	$('.sub li').on('click', function(){
		$(this).parent().hide(0);
		
	});
	
	
	$(".sel").each(function(){
		var s=$(this);
		var z=parseInt(s.css("z-index"));
		var dt=$(this).children("dt");
		var dd=$(this).children("dd");
		var _show=function(){dd.slideDown(200);dt.addClass("cur");s.css("z-index",z+1);};   //展开效果
		var _hide=function(){dd.slideUp(200);dt.removeClass("cur");s.css("z-index",z);};    //关闭效果
		dt.click(function(){dd.is(":hidden")?_show():_hide();});	
       $("body").click(function(i){ !$(i.target).parents(".sel").first().is(s) ? _hide():"";});
	})
	shortcut();
	
});
</script>

</body>
</html>